#include <stdio.h>
#include <string.h>

#include "security.h"
#include "security_error.h"
#include "security_common.h"

void internal_test() {
    char src[] = "12345678";
    char key[8] = {'1', '2', '3', '4', '5', '6', '7', '8'};

    char en[128] = { 0 };
    size_t en_len = 0;

    char de[128] = { 0 };
    size_t de_len = 0;

    int ret = 0, i;

    ret = security_des_encrypt(en, &en_len, sizeof(en), src, strlen(src), key);
    printf("encrypt ret = 0x%04x\n", ret);
    for(i = 0; i < en_len; i++) {
        printf("%02x", (unsigned char)en[i]);
    }
    printf("\n");

    ret = security_des_decrypt(de, &de_len, sizeof(de), en, en_len, key);
    printf("decrypt ret = 0x%04x\n", ret);
    for(i = 0; i < de_len; i++) {
        printf("%02x ", (unsigned char)de[i]);
    }

}